/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vale.sax.sintaxis;

/**
 *
 * @author vale
 */
public final class ValidadorSintaxis {

    public static final byte XML_SYNTAX_ERROR = -1;
    public static final byte START_ELEMENT = 0;// < nombra variable1="valor" valor2="sss".....>
    public static final byte END_ELEMENT = 1;
    public static final byte INSERT_CONTENT = 2;
    public static final byte DTD_DATA = 3;
    public static final byte DOC_INFO = 4;  //<?xml version="1.0" encoding="ISO-8859-1" ?>
    public static final byte START_DOCUMENT = 5;
    public static final byte END_DOCUMENT = 6;
    public static final byte AUTO_CLOSE_ELEMENT = 7;//< nombra variable1="valor" valor2="sss"...../>
    public static final byte COMMENT = 8;
    private BalancedXml balanceo;

    public ValidadorSintaxis() {
        this.balanceo = new BalancedXml();
    }

    public byte validate(String xmlElment) {
        byte type = ValidadorSintaxis.XML_SYNTAX_ERROR;
        if (EndElement.validate(xmlElment)) {
            type = ValidadorSintaxis.END_ELEMENT;
        }
        balanceo.validate(xmlElment, type);
        return type;
    }

    public boolean isBalanced() {
        return balanceo.isBalanced();
    }
}
